package com.job;

import com.service.UserService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author HuangSuip
 */
@Service
public class FirstJob extends BaseJob {

    private final Logger logger = LoggerFactory.getLogger(FirstJob.class);


    @Autowired
    private UserService userService;

    @Override
    public String getCronExpression() {
        return "*/5 * * * * ? *";
    }
    @Override
    public String getGroupName() {
        return "Group name";
    }

    @Override
    public String getJobName() {
        return "firstJob";
    }

    public Job getMyTargetObject() {
        return this;
    }

    @Override
    public void execute(JobExecutionContext jobExecutionContext) {
        System.out.println("First Job");
        logger.info("----------First Job---------------");
        System.out.println(userService.getName());
    }
}
